<?php

namespace Database\Factories;

use App\Models\Order;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;


class OrderFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = Order::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'user_id' => $this->faker->randomElement(User::pluck('id')),
            'mer_id' => $this->faker->numberBetween(1, 50),
            'cart_id' => $this->faker->numberBetween(1, 100),
            'store_id' => $this->faker->numberBetween(1, 50),
            'pink_id' => $this->faker->numberBetween(1, 50),
            'clerk_id' => $this->faker->numberBetween(1, 50),
            'order_number' => $this->faker->randomNumber(8) . time(),
            'user_name' => $this->faker->text(15),
            'user_phone' => $this->faker->phoneNumber,
            'user_address' => $this->faker->address,
            'type' => $this->faker->randomElement([
                'ordinaryOrder',
                'pinkOrder',
                'seckillOrder',
                'bargainOrder'
            ]),

            'status' =>$this->faker->randomElement([
                'noPaid',
                'noDelivered',
                'toBeReceived',
                'beEvaluated',
                'dealDone',
                'toBeWriteOff',
                'writtenOff',
            ]),
            'refund_status' => $this->faker->randomElement([
                '',
                '',
                '',
                'Refund_only',
                'Refund_return',
                'Refuse_refund',
                'toBe_returned',
                'toBe_received',
                'refunded',
            ]),
            'refund_reason_wap_img' => 'http://placeimg.com/200/120/any',
            'refund_reason_wap_explain' => $this->faker->text(10),
            'mark' => $this->faker->text(10),
            'refund_reason_time' => $this->faker->time('Y-m-d H:i:s'),
            'total_num' => $this->faker->numberBetween(1, 10),
            'total_price' => $this->faker->randomFloat(2, 20, 9999),
            'pay_type' => $this->faker->randomElement([
                'wechat',
                'alipay',
                'balance',
                'offline',
            ]),
            'pay_time' => $this->faker->date(),
            'delivery_name' => $this->faker->name,
            'delivery_code' => $this->faker->numberBetween(1000000000, 9999999999),
            'delivery_type' => $this->faker->randomElement([
                'YT',
                'SF',
                'YD'
            ]),
            'delivery_id' => $this->faker->numberBetween(1, 30),
            'gain_integral' => $this->faker->numberBetween(10, 100),
            'use_integral' => $this->faker->numberBetween(10, 100),
            'back_integral' => $this->faker->numberBetween(1, 10),
            'unique' => $this->faker->md5,
            'seckill_id' => $this->faker->numberBetween(1, 50),
            'cost' => $this->faker->randomFloat(null, 10, 5000),
            'pay_price' => $this->faker->randomFloat(null, 10, 4000),
            'verify_code' => $this->faker->text(12),
            'paid' => $this->faker->numberBetween(0,1),
            'is_remind' => $this->faker->numberBetween(0,1),
            'is_user_delete' => $this->faker->numberBetween(0,1),
            'shipping_type' => $this->faker->numberBetween(0,1),
            'is_mer_check' => $this->faker->numberBetween(0,1),
            'promoter_id'=>$this->faker->numberBetween(1,50),
            'bargain_id' =>$this->faker->numberBetween(1,50),
            'delivery_uid' =>$this->faker->numberBetween(1,50),
            'fictitious_content'=>$this->faker->text(24),

        ];
    }
}

